package br.ufc.engsoft;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import br.ufc.engsoft.util.JSONFunctions;

public class SearchView extends Activity {
	
	EditText textSearched;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.searchview);
		textSearched =  (EditText) findViewById(R.id.searchText);
		
		Button bBuscarPagina = (Button) findViewById(R.id.b_buscarPagina);
		
		bBuscarPagina.setOnClickListener(new Button.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				
				String titulo_buscado = String.valueOf(textSearched.getText());
				
				Log.i("texto do click", titulo_buscado);
				//EditText searchText = (EditText) findViewById(R.id.searchText);
				String nomePagina = JSONFunctions.getPageTitle(titulo_buscado);
				Intent intent = new Intent(SearchView.this,GenericView.class);
				intent.putExtra("title", nomePagina);
				
				startActivity(intent);
				
			}
		});
		
		
		

		
		//textSearched.setText(nomePagina);
		
		
	}

}
